package com.eastfair.venueservice.entity;

import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.annotation.ExcelEntity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.eastfair.core.base.entity.Entity;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.Map;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;
import static com.eastfair.core.utils.DateUtils.DEFAULT_DATE_TIME_FORMAT;
import com.eastfair.annotation.model.EchoVO;
import com.eastfair.venueservice.enumeration.WorkOrderLinkOperationTypeEnum;

import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE;

/**
 * <p>
 * 实体类
 * 工单环节
 * </p>
 *
 * @author linan
 * @since 2022-11-10
 */
@Data
@NoArgsConstructor
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("vsm_work_order_link")
@ApiModel(value = "WorkOrderLink", description = "工单环节")
@AllArgsConstructor
public class WorkOrderLink extends Entity<Long> implements EchoVO {

    private static final long serialVersionUID = 1L;
    @TableField(exist = false)
    private Map<String, Object> echoMap = new HashMap<>();
    /**
     * 是否启用（确认状态）：1是 已确认；0否 未确认
     */
    @ApiModelProperty(value = "是否启用（确认状态）：1是 已确认；0否 未确认")
    @TableField(value = "is_enabled")
    @Excel(name = "是否启用（确认状态）：1是 已确认；0否 未确认")
    private Integer isEnabled;

    /**
     * 是否删除：1是；0否
     */
    @ApiModelProperty(value = "是否删除：1是；0否")
    @TableField(value = "is_deleted")
    @Excel(name = "是否删除：1是；0否")
    private Integer isDeleted;

    /**
     * 项目id
     */
    @ApiModelProperty(value = "项目id")
    @TableField(value = "project_id")
    @Excel(name = "项目id")
    private Long projectId;

    /**
     * 子系统id
     */
    @ApiModelProperty(value = "子系统id")
    @TableField(value = "subsystem_id")
    @Excel(name = "子系统id")
    private Long subsystemId;

    /**
     * 租户id
     */
    @ApiModelProperty(value = "租户id")
    @TableField(value = "tenant_id")
    @Excel(name = "租户id")
    private Long tenantId;

    /**
     * 工单编号
     */
    @ApiModelProperty(value = "工单编号")
    @Size(max = 255, message = "工单编号长度不能超过255")
    @TableField(value = "work_order_no", condition = LIKE)
    @Excel(name = "工单编号")
    private String workOrderNo;

    /**
     * 操作环节类型 #{CREATE:生成工单;ACCEPT:接收工单;DISPOSAL:处理工单;FINISH:工单完结;REVOKE:撤销工单}
     */
    @ApiModelProperty(value = "操作环节类型 #{CREATE:生成工单;ACCEPT:接收工单;DISPOSAL:处理工单;FINISH:工单完结;REVOKE:撤销工单}")
    @TableField(value = "operation_type")
    @Excel(name = "操作环节类型 #{CREATE:生成工单;ACCEPT:接收工单;DISPOSAL:处理工单;FINISH:工单完结;REVOKE:撤销工单}", replace = {"生成工单_CREATE", "接收工单_ACCEPT", "处理工单_DISPOSAL", "工单完结_FINISH", "撤销工单_REVOKE",  "_null"})
    private WorkOrderLinkOperationTypeEnum operationType;

    /**
     * 人员id
     */
    @ApiModelProperty(value = "人员id")
    @TableField(value = "user_id")
    @Excel(name = "人员id")
    private Long userId;

    /**
     * 人员姓名
     */
    @ApiModelProperty(value = "人员姓名")
    @Size(max = 255, message = "人员姓名长度不能超过255")
    @TableField(value = "user_name", condition = LIKE)
    @Excel(name = "人员姓名")
    private String userName;

    /**
     * 部门id
     */
    @ApiModelProperty(value = "部门id")
    @TableField(value = "org_id")
    @Excel(name = "部门id")
    private Long orgId;

    /**
     * 部门名称
     */
    @ApiModelProperty(value = "部门名称")
    @Size(max = 255, message = "部门名称长度不能超过255")
    @TableField(value = "org_name", condition = LIKE)
    @Excel(name = "部门名称")
    private String orgName;

    /**
     * 操作时间
     */
    @ApiModelProperty(value = "操作时间")
    @TableField(value = "operation_time")
    @Excel(name = "操作时间", format = DEFAULT_DATE_TIME_FORMAT, width = 20)
    private LocalDateTime operationTime;


    @Builder
    public WorkOrderLink(Long id, Long createdBy, LocalDateTime createTime, Long updatedBy, LocalDateTime updateTime, 
                    Integer isEnabled, Integer isDeleted, Long projectId, Long subsystemId, Long tenantId, 
                    String workOrderNo, WorkOrderLinkOperationTypeEnum operationType, Long userId, String userName, Long orgId, String orgName, LocalDateTime operationTime) {
        this.id = id;
        this.createdBy = createdBy;
        this.createTime = createTime;
        this.updatedBy = updatedBy;
        this.updateTime = updateTime;
        this.isEnabled = isEnabled;
        this.isDeleted = isDeleted;
        this.projectId = projectId;
        this.subsystemId = subsystemId;
        this.tenantId = tenantId;
        this.workOrderNo = workOrderNo;
        this.operationType = operationType;
        this.userId = userId;
        this.userName = userName;
        this.orgId = orgId;
        this.orgName = orgName;
        this.operationTime = operationTime;
    }

}
